// <reference types="vite/client" />
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// const path = require('path');
import path from 'path'

export default defineConfig({
  plugins: [react()],
  resolve: {
    // 配置路径别名
    alias: {
      '@': path.resolve(__dirname, './src'),
    },
  },
  server: {
    proxy: {
      '/qny': {
        target: 'http://127.0.0.1:8081', // 代理目标的URL
        changeOrigin: true, // 如果需要跨域请求，设置为true
        rewrite: (path) => path.replace(/^\/qny/, '/qny'), // 可选的路径重写规则
      },
    }
  }
})
